function toCamel (str) {
  let res = str
  const temp = str.matchAll(/_[a-z]/g)
  ;[...temp].forEach(item => {
    res = res.replace(item[0], item[0][1].toUpperCase())
  })
  // return str.replace(temp, temp.slice(1).toUpperCase())
  return res
}

function toUnderLine (str) {
  let res = str
  const temp = str.matchAll(/[A-Z]/g)
  ;[...temp].forEach(item => {
    res = res.replace(item[0], '_' + item[0].toLowerCase())
  })
  return res
}
console.log(toCamel('_ab_ba_c'))
console.log(toUnderLine('getElementById'))
